package com.itheima.mapper;

import com.itheima.pojo.Clazz;
import com.itheima.pojo.ClazzQueryParam;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDate;
import java.util.List;
import java.util.Map;

@Mapper
public interface ClazzMapper {

    /**
     * 分页查询
     * @param
     * @return
     */
    //List<Clazz> list(ClazzQueryParam clazzQueryParam);
   List<Clazz> list(String name, LocalDate begin, LocalDate end);
    /**
     * 新增班级
     * @param clazz
     */
    @Insert("insert into clazz(name, room, begin_date, end_date, master_id, subject, create_time, update_time) " +
            "values (#{name}, #{room}, #{beginDate}, #{endDate}, #{masterId}, #{subject}, #{createTime}, #{updateTime})")
    void insert(Clazz clazz);

    /**
     * 根据id查询班级信息
     * @param id
     * @return
     */
    @Select("select * from clazz where  id = #{id}")
    Clazz getInfo(Integer id);

    /**
     * 修改班级信息
     * @param clazz
     */
    void updateById(Clazz clazz);

    /**
     * 根据id删除班级
     * @param id
     */
    @Delete("delete from clazz where id = #{id}")
    void deleteById(Integer id);

     /**
      * 查询所有班级
      */
     @Select("select * from clazz")
      List<Clazz> findAll();

}
